package com.woniu.apartment.mapper;

import java.util.List;

import com.woniu.apartment.myVo.PopularApartmentVo;
import com.woniu.apartment.domain.ApartmentMain;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Param;

/**
 * 公寓Mapper接口
 *
 * @author yy
 * @date 2023-04-03
 */
public interface ApartmentMainMapper
{
    /**
     * 查询公寓
     *
     * @param id 公寓主键
     * @return 公寓
     */
    public ApartmentMain selectApartmentMainById(Long id);

    /**
     * 查询公寓列表
     *
     * @param apartmentMain 公寓
     * @return 公寓集合
     */
    public List<ApartmentMain> selectApartmentMainList(ApartmentMain apartmentMain);

    /**
     * 新增公寓
     *
     * @param apartmentMain 公寓
     * @return 结果
     */
    public int insertApartmentMain(ApartmentMain apartmentMain);

    /**
     * 修改公寓
     *
     * @param apartmentMain 公寓
     * @return 结果
     */
    public int updateApartmentMain(ApartmentMain apartmentMain);

    /**
     * 删除公寓
     *
     * @param id 公寓主键
     * @return 结果
     */
    public int deleteApartmentMainById(Long id);

    /**
     * 批量删除公寓
     *
     * @param ids 需要删除的数据主键集合
     * @return 结果
     */
    public int deleteApartmentMainByIds(Long[] ids);


    @Select("SELECT a.id as id ,a.apartment_name,a.image_url ,a.currency ,a.comments ,a.rent ,a.address_info,a.brief_desc,a.facility_score,a.traffic_score,a.security_score,a.service_score,a.cost_per_score,a.score\n" +
            "FROM tb_apartment_main a\n" +
            "WHERE id =#{id}")
    ApartmentMain selectPartInfoById(Long id);


    void updateSocerById(Long apartmentId);

    @Select("select * from tb_apartment_main")
    List<ApartmentMain> selectAll();


    List<PopularApartmentVo> searchNearbyPopularCityApartmentList(@Param(value = "cityId") String cityId);

    List<PopularApartmentVo> searchApartmentListByCityName(@Param(value = "searchContent") String searchContent);

    List<PopularApartmentVo> searchApartmentListByUniversityName(String searchContent);

    List<PopularApartmentVo> searchApartmentListByApartmentName(String searchContent);

    List<PopularApartmentVo> searchApartmentListByECityName(String searchContent);

    List<PopularApartmentVo> searchApartmentListByEUniversityName(String searchContent);
}
